// #include <iostream>
// #include<string>
// #include <vector>
// #include <algorithm>
// #include <iomanip>
// #include <cmath>
// #include <map>
// #include<unordered_map>
#include<bits/stdc++.h>
using namespace std;
// #define forn(i, n) for (int i = 0; i < int(n); i++)
#define pb push_back
using ll =long long;
int N=1e7+10;
//vector<int>isprime(N,1);
//void _isprime()
// {
// isprime[1]=isprime[0]=0;
// for(int i=2;i<N;i++)
// {
// if(isprime[i]==1)
// {
// for(int j=2*i;j<N;j+=i)
// {
// isprime[j]=0;
// }
// }
// }
// }
int bToD(string n)
{
string num = n;
int dec_value = 0;
// Initializing base value to 1, i.e 2^0
int base = 1;
int len = num.length();
for (int i = len - 1; i >= 0; i--) {
if (num[i] == '1')
dec_value += base;
base = base * 2;
}
return dec_value;
}
// bool isprime(ll a)
// {
// if(a==1)
// {
// return true;
// }
// for(ll i=2;i<=sqrt(a);i++)
// {
// if(a%i==0)
// {
// return false;
// }
// }
// return true;
// }
string DecimalToBinary(int num)
{
string str;
while(num){
if(num & 1) // 1
str+='1';
else // 0
str+='0';
num>>=1; // Right Shift by 1
}
return str;
}
long long binconvert(int n)
{
long long bin = 0;
int rem, i = 1;
while (n!=0) {
rem = n % 2;
n /= 2;
bin += rem * i;
i *= 10;
}
return bin;
}
int arr[23];
void facto()
{arr[0]=1;
arr[1]=1;
arr[2]=2;
for(int i=3;i<=22;i++)
{
arr[i]=arr[i-1]+arr[i-2];
}
}
double factorial(int n) {
if(n == 0)
return 1;
double factorial = 1;
for (double i = 2; i <= n; i++)
factorial = factorial * i;
return factorial;
}
ll gcd(ll a,ll b)
{
if(b==0)
{
return a;
}
return gcd(b,a%b);
}
int lcsub(string S,char K)
{
int currc = 0, prevc = 0, maxl;
for (int i = 0; i < S.size(); i++)
{
if (S[i] == K) {
currc += 1;
}
else {
prevc = max(prevc, currc);
currc = 0;
}
}
prevc = max(prevc, currc);
maxl = prevc;
return maxl;
}
ll sum(string s)
{
int sum1=0;
for(auto i:s)
{
sum1+=int(i-48);
}
return sum1;
}
ll nCr(ll n, ll r) {
return factorial(n) / (factorial(r) * factorial(n - r));
}
void solve()
{
string s;
cin>>s;
int n=s.size()+1;
for(int i=0;i<n;i++)
{
for(int j='a';j<'z'+1;j++)
{
string t=s.substr(0,i)+string(1,j)+s.substr(i);
string u=t;
reverse(u.begin(),u.end());
if(u==t)
{
cout<<t<<endl;
return;
}
}
}
cout<<"NA"<<endl;
}
int main() {
// freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
// facto();
int t=1;
//cin>>t;
while(t--)
{
solve();
}
//cout<<"hfheng";
}
1527A. And Then There Were K | 1689. Partitioning Into Minimum Number Of Deci-Binary Numbers |
318. Maximum Product of Word Lengths | 448. Find All Numbers Disappeared in an Array |
1155. Number of Dice Rolls With Target Sum | 415. Add Strings |
22. Generate Parentheses | 13. Roman to Integer |
2. Add Two Numbers | 515. Find Largest Value in Each Tree Row |
345. Reverse Vowels of a String | 628. Maximum Product of Three Numbers |
1526A - Mean Inequality | 1526B - I Hate 1111 |
1881. Maximum Value after Insertion | 237. Delete Node in a Linked List |
27. Remove Element | 39. Combination Sum |
378. Kth Smallest Element in a Sorted Matrix | 162. Find Peak Element |
1529A - Eshag Loves Big Arrays | 19. Remove Nth Node From End of List |
925. Long Pressed Name | 1051. Height Checker |
695. Max Area of Island | 402. Remove K Digits |
97. Interleaving String | 543. Diameter of Binary Tree |
124. Binary Tree Maximum Path Sum | 1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts |